package main

import (
	"fmt"
	"math/rand"
	"time"
)

func ActionGenerate() {
	var userNumber, userName []string
	userNumber = []string{"洗澡", "睡觉", "打游戏", "画画", "追剧", "加班"}
	userName = []string{"张三", "李四", "王五", "宋兵甲", "炮灰乙", "流氓丙", "土匪丁", "爱新觉罗.阿拉拉"}
	result := simulateUserAction(userName, userNumber)
	fmt.Println(result)
}

type userAction struct {
	userID   int
	userName string
	action   string
	time     int64
}

func simulateUserAction(username []string, actions []string) []userAction {
	var userActions []userAction
	for i := 0; i < len(username); i++ {
		action := actions[rand.Intn(len(actions))]
		userActionAppend := userAction{
			userID:   i,
			userName: username[i],
			action:   action,
			time:     time.Now().UnixNano(),
		}
		userActions = append(userActions, userActionAppend)
	}
	return userActions
}
